<?php

/**
 * @filename: exdisplay.class.php
 * @usage: Contains all extended display functions
 */

class Display_Exdisplay extends Display_Display {

	/**
	 * @var: $_url
	 * @usage: Contains the url data
	 */
	var $_url;

	/**
	 * @function: __construct
	 * @usage: Set the display and call the render function
	 */
	public function __construct($url) {
	
		// Set the url variable up
		$this->_url = $url;
		
		// Call the render display function
		$this->renderDisplay($this->_url);
	
	}
	
	/**
	 * @function: renderDisplay
	 * @usage: Render the display dependant on url
	 */
	public function renderDisplay($action) {
	
		// Start a switch dependant on the action
		switch ($action) {
		
			// If the url is podcast, display the podcast function
			case "podcast":
				$this->podcastDisplay();
			break;
			
			// If it was PDF, you get the idea
			case "pdf":
				$this->pdfDisplay();
			break;
			
			// Upload the podcast
			case "addcast":
				$addcast = new Db_Uploads($_POST, $_FILES);
			break;
			
			// Upload the PDF
			case "addpdf":
				$addpdf = new Db_Uploads($_POST, $_FILES);
			break;
			
			default:
				echo "Welcome to the admin section";
			break;
		
		}
	
	}
	
	/**
	 * @function: podcastDisplay
	 * @usage: Display the podcast upload form
	 */
	public function podcastDisplay() {
	
		// Empty html variable
		$html = "";
		
		// Create the form
		$html .= "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?act=addcast\">\n";
		
			$html .= "<table>";
			
				$html .= "<tr><td>Podcast Title (Required)</td><td><input type=\"text\" name=\"title\" /></td></tr>";
				$html .= "<tr><td>Podcast File (Required)</td><td><input type=\"file\" name=\"podcast\" /></td></tr>";
				$html .= "<tr><td>Podcast Description</td><td><textarea name=\"description\" rows=\"8\" cols=\"70\"></textarea></td></tr>";
				
				$html .= "<tr><td><input type=\"submit\" name=\"submit\" value=\"Submit Podcast\" /></td></tr>";
			
			$html .= "</table>";
		
		$html .= "</form>";
	
		// Echo the html
		echo $html;
	
	}
	
	/**
	 * @function: pdfDisplay
	 * @usage: Display the pdf upload form
	 */
	public function pdfDisplay() {
	
		// Empty html variable
		$html = "";
		
		// Create the form
		$html .= "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?act=addpdf\">\n";
		
			$html .= "<table>";
			
				$html .= "<tr><td>PDF Title (Required)</td><td><input type=\"text\" name=\"title\" /></td></tr>";
				$html .= "<tr><td>PDF File (Required)</td><td><input type=\"file\" name=\"pdf\" /></td></tr>";
				$html .= "<tr><td>PDF Description</td><td><textarea name=\"description\" rows=\"8\" cols=\"70\"></textarea></td></tr>";
				
				$html .= "<tr><td><input type=\"submit\" name=\"submit\" value=\"Submit PDF\" /></td></tr>";
			
			$html .= "</table>";
		
		$html .= "</form>";
	
		// Echo the html
		echo $html;
	
	}

}

?>